package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Compensation;
import cn.wolfcode.crm.domain.Task;
import cn.wolfcode.crm.mapper.CompensationMapper;
import cn.wolfcode.crm.mapper.TaskMapper;
import cn.wolfcode.crm.query.CompensationQueryObject;
import cn.wolfcode.crm.query.TaskQueryObject;
import cn.wolfcode.crm.service.ICompensationService;
import cn.wolfcode.crm.service.ITaskService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * Created by Administrator on 2018/6/12.
 */

@Service
public class CompensationServiceImpl implements ICompensationService {

    @Autowired
    private CompensationMapper compensationMapper;


    @Override
    public PageResult query(CompensationQueryObject qo) {
        int count = compensationMapper.query4Count(qo);
        if (count > 0) {
            return new PageResult(count, compensationMapper.query4List(qo));
        }
        return new PageResult(count, Collections.EMPTY_LIST);
    }

    @Override
    public void updateByPrimaryKey(Compensation compensation) {
        compensationMapper.updateByPrimaryKey(compensation);
    }

    @Override
    public void insert(Compensation compensation) {
        compensationMapper.insert(compensation);
    }

    @Override
    public void changeState(Compensation compensation) {
        compensationMapper.changeState(compensation);
    }

    @Override
    public List<Compensation> selectAll() {

        return compensationMapper.selectAll();
    }


}
